<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Role_model extends MY_Model
{
	/**
	 * 获取管理员列表
	 * 
	 * return array
	 */
	public function getRolelList()
	{
		$query = $this->db->get('blues_admin_role');
		return $query->result_array();
	}

    //添加角色及权限
    public function setSystemPower($groupID,$data = array()){
        if($groupID){
            $this->db->where("id",$groupID);
            $res = $this->db->update("blues_admin_role",$data);
        }else{
            $res = $this->db->insert("blues_admin_role",$data);
        }
        return $res;
    }

    //根据id获取权限信息
    public function getPowerInfo($id){
        $this->db->where("id",$id);
        $query = $this->db->get("blues_admin_role");
        return $query->row_array();
    }
    //删除角色
    public function delRolebyid($id){
        $this->db->where("id",$id);
        $res = $this->db->delete("blues_admin_role");
        return $res;
    }

    //设置开启状态
    public function setStatus($id,$status){
        if(empty($id) && empty($status)){
            return false;
        }
        $this->db->where("id",$id);
        $res = $this->db->update("blues_admin_role",array("status"=>$status));
        return $res;
    }

}

/* End of file codeinfo_model.php */
/* Location: ./application/models/luckydog/codeinfo_model.php */
